﻿using System.Collections.Generic;
using ScoutersLog.DataAccess.Persistence;

namespace ScoutersLog.Model.Factory
{
    public class UnitFactory
    {
        public static Unit GetUnit(int unitId)
        {
            return (Unit)SharedSession.Get(typeof(Unit), unitId);
        }
        public static IList<Unit> GetUnitList()
        {
            return SharedSession.LoadList<Unit>("UnitNumber");
        }
        public static void DeleteUnit(int unitId)
        {
            DeleteUnit(GetUnit(unitId));
        }
        public static void DeleteUnit(Unit unit)
        {
            SharedSession.Delete(unit);
        }
        public static void Save(Unit unit)
        {
            SharedSession.SaveOrUpdate(unit);
        }
    }
}
